package com.lixinlei.tech.common.factory;


import com.lixinlei.tech.common.Codec;
import com.lixinlei.tech.common.impl.ApacheCodec;
import com.lixinlei.tech.common.impl.SnappyCodec;

/**
 * 选择编解码器
 */
public class CodecFactory {
    public static Codec getCodec(CodecTypeEnum codecTypeEnum) {
        if (codecTypeEnum.equals(CodecTypeEnum.SNAPPY)) {
            return new SnappyCodec();
        }
        return new ApacheCodec(codecTypeEnum.getType());
    }
}
